﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Reportes : System.Web.UI.Page
{
    


    modeloMostrarHorario hr = new modeloMostrarHorario();
    public ArrayList ITI = new ArrayList();
    public ArrayList Esp = new ArrayList();
    public ArrayList tic = new ArrayList();

    ArrayList matutinoTroncoComun = new ArrayList();//horario de todos los TIC sin especialidades
    ArrayList matutinoEspecialidad = new ArrayList();//horario de MCE, RT y SI
    ArrayList vespertino = new ArrayList();//horario de ITI

    protected void Page_Load(object sender, EventArgs e)
    {   
       
            DateTime dateValue = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            int dia = (int)dateValue.DayOfWeek;

            Esp = hr.listaTICEspecialidad(dia);//funciona ... horario de especialidades
            tic = hr.listaTICTroncoComun(dia);
            ITI = hr.horarioITI(dia);

            Session.Add("ITI", ITI);
            txtnum.Attributes.Add("onkeypress", "javascript:return ValidNum(event);");
    }

    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        controladorautenticacion au = new controladorautenticacion();
        string  grupo = hidenid.Value;
        int idprofe =Convert.ToInt32(hidenprof.Value);
        int hora = Convert.ToInt32(hidenhor.Value);
        int idhorario = Convert.ToInt32(hidenidhor.Value);
        if (txtuser.Text !="" && txtcontra.Text != "" && txtnum.Text!="")
        {
            if (au.AutenticarProfesores(idprofe, txtcontra.Text, txtuser.Text, Convert.ToInt32(txtnum.Text), grupo, hora, idhorario))
            {
                Response.Redirect("OK.aspx");
            }
            else 
            {
                Response.Redirect("bad.aspx");
            }
        }
        else 
        {
            Response.Redirect("bad.aspx");
        }
    }

    /// <summary>
    /// Metodo que convierte el numero de hora en cadena de rango de hora para mostrar en pantalla
    /// </summary>
    /// <param name="hora"></param>
    /// <returns></returns>
    public string horaClases(int hora) {
        string rango = "";
        switch (hora) {
            case 1:
                rango = "7:00-8:00";
                break;
            case 2:
                rango = "8:00-9:00";
                break;
            case 3:
                rango = "9:00-10:00";
                break;
            case 4:
                rango = "10:00-11:00";
                break;
            case 5:
                rango = "11:00-12:00";
                break;
            case 6:
                rango = "12:00-1:00";
                break;
            case 7:
                rango = "1:00-2:00";
                break;
            case 8:
                rango = "2:00-3:00";
                break;
            case 9:
                rango = "3:00-4:00";
                break;
            case 10:
                rango = "4:00-5:00";
                break;
            case 11:
                rango = "5:00-6:00";
                break;
            case 12:
                rango = "6:00-7:00";
                break;
            case 13:
                rango = "7:00-8:00";
                break;
            case 14:
                rango = "8:00-9:00";
                break;
        }
        return rango;
    }

}
